home *** CD-ROM | disk | FTP | other *** search
/ InterCD 2001 April / april_2001.iso / intercd / root / Browsers / ^Enfish_Onespace / setup.exe / setup.cab / ListBox2.js < prev    next >
Encoding:
Text File  |  2000-10-11  |  1.6 KB  |  60 lines

  1.  
  2. function add_listbox_item(list_box, strItemHtml)
  3.     {
  4.     if (strItemHtml == null || list_box == null || list_box.className != "ListBoxNormal")
  5.         return;
  6.         
  7.     var strId = list_box.id + list_box.children.length;
  8.     
  9.     strInsertString = create_div_begin_tag(strId) + strItemHtml + create_div_end_tag();
  10.     list_box.insertAdjacentHTML("BeforeEnd",strInsertString);
  11.     
  12.     var objCurrentItem = window.document.all[strId];
  13.     set_div_item_events(objCurrentItem);
  14.     return objCurrentItem;
  15.     }
  16.  
  17. function get_listbox(objCurrent)
  18.     {
  19.     while (objCurrent != null && objCurrent.className != "ListBoxNormal" && objCurrent.className != "ListBoxHover")
  20.         {
  21.         objCurrent = objCurrent.parentElement;
  22.         }
  23.     return objCurrent;
  24.     }
  25.     
  26. function set_listbox_events(objCurrent)
  27.     {
  28.     if (objCurrent == null)
  29.         {
  30.         for (var nIndex = 0; nIndex < document.body.all.length; nIndex++)
  31.             {
  32.             if (document.body.all[nIndex].className == "ListBoxNormal")
  33.                 {
  34.                 set_listbox_events(document.body.all[nIndex])
  35.                 }
  36.             }
  37.         return;
  38.         }
  39.     
  40.     if (objCurrent.className == "ListBoxNormal")
  41.         {
  42.         objCurrent.onmouseover = listbox_onmouseover;
  43.         objCurrent.onmouseout = listbox_onmouseout;
  44.         }
  45.     }
  46.  
  47. function listbox_onmouseout() 
  48.     {
  49.     var objCurrent = get_listbox(window.event.srcElement);
  50.     objCurrent.idTimeout = setTimeout("window.document.all["+objCurrent.sourceIndex+"].className = \"ListBoxNormal\"",1);
  51.     }
  52.  
  53. function listbox_onmouseover() 
  54.     {
  55.     var objCurrent = get_listbox(window.event.srcElement);
  56.     if (objCurrent.idTimeout != null)
  57.         clearTimeout(objCurrent.idTimeout);
  58.     objCurrent.className = "ListBoxHover";
  59.     }
  60.